<?php
/***************************************************************************
 * 
 * Copyright (c) 2011 , Inc. All Rights Reserved
 * $Id$ 
 * 
 **************************************************************************/

include_once dirname(__FILE__).'/../Image.php';

 
 
/**
 * @file ImageTest.php
 * @author lepton(eb-rd@)
 * @date 2011/06/26 21:05:26
 * @version $Revision$ 
 * @brief 
 *  
 **/
class ImageTest extends PHPUnit_Framework_TestCase
{
/*
function testImagick(){
$start=microtime(true);
//$imagick=new Imagick("/home/mall/youa-php/lib/mccom/test/resource/Glenda_31_mar_2006_0230Z.jpg");
$imagick=new Imagick("/home/mall/youa-php/lib/mccom/test/resource/backkom3.jpg");
$end=microtime(true);

echo "imagick cosume time:" .($end-$start)."\n";

$imagick->getImageBlob();

$end2=microtime(true);

echo "getImageBlob time :". ($end2-$end)."\n";

}
*/
function testCropThumbnail(){
$imagick=new Imagick("/home/mall/youa-php/mytest/test.png");
echo "before crop:\n";
echo "width :". $imagick->getImageWidth()." height: ".$imagick->getImageHeight()."\n";
$imagick=new Imagick("/home/mall/youa-php/mytest/test.png");

$imagick->resizeImage($imagick->getImageWidth()/2,$imagick->getImageHeight()/2,imagick::FILTER_CATROM,1,true);
echo "after crop first:\n";
echo "width/2, height/2: real width:".$imagick->getImageWidth()." real height: ".$imagick->getImageHeight()."\n";
$imagick=new Imagick("/home/mall/youa-php/mytest/test.png");
$imagick->resizeImage($imagick->getImageWidth()/2,$imagick->getImageHeight()/3,imagick::FILTER_CATROM,1,true);
echo "width/2, height/3: real width:".$imagick->getImageWidth()." real height: ".$imagick->getImageHeight()."\n";
$imagick=new Imagick("/home/mall/youa-php/mytest/test.png");
$imagick->resizeImage($imagick->getImageWidth()/3,$imagick->getImageHeight()/2,imagick::FILTER_CATROM,1,true);
echo "width/3, height/2: real width:".$imagick->getImageWidth()." real height: ".$imagick->getImageHeight()."\n";
}
function testWatermarkText(){
$imag=new Image("/home/mall/youa-php/mytest/test.png");
$imag->watermarkText(0,0.1,-45);
//$imag->watermarkText(3,0.05,45);
//$imag->watermarkText(7,1,45);
//$imag->watermarkText(9,0.1,-45,"baidu",array('fontcolor'=>"#0000ff"));
$imag->getImagick()->writeImage('watermarkText.png');

}
function testWatermarkTextImage(){
$img=new Image("/home/mall/youa-php/mytest/test.png");
$img->watermarkTextImage(0);

$img->getImagick()->writeImage("watermarkTextImage.png");
}

function testWatermarkImage(){
$img=new Image("/home/mall/youa-php/mytest/test.png");
$img->watermarkImage(0);

$img->getImagick()->writeImage("watermarkImage.png");

}
/*
function testWatermarkImage(){
$start=microtime(true);
$image=new Image("/home/mall/youa-php/lib/mccom/test/resource/backkom3.jpg");
$start2=microtime(true);
echo "new image time:".($start2-$start)."\n";
$image->watermark();
$start3=microtime(true);
echo "watermark time:".($start3-$start2)."\n";
$image->writeFormatImage("watermark2","jpg");

$start4=microtime(true);
echo "writeFormateImage time:".($start4-$start3)."\n";
}

function testCompress(){
$start=microtime(true);
$image=new Image("/home/mall/youa-php/lib/mccom/test/resource/bridge.jpg");
$start2=microtime(true);
echo "new image time:".($start2-$start)."\n";
$image->compress('bzip',80);
$start3=microtime(true);
echo "compress time:".($start2-$start)."\n";
$image->writeFormatImage("compress2",'jpg');
$start4=microtime(true);
echo "writeFormateImage time:".($start2-$start)."\n";
$image->changeFormat("png");
$start5=microtime(true);
echo "changFormat time:".($start2-$start)."\n";
}


*/




}





/* vim: set ts=4 sw=4 sts=4 tw=100 noet: */
?>
